package beans;

import com.google.gson.Gson;

// just a simple object to store the data for a line item in the backlog (one row from the database query)
public class BacklogItemBean {
	int userStoryId;
	String userStoryName;
	String userStoryDescription;
	int userStoryType;
	String userStoryTypeName;
	Integer userStoryStoryPoints;	// allow for null

	public int getUserStoryId() {
		return userStoryId;
	}
	
	public void setUserStoryId(int userStoryId) {
		this.userStoryId = userStoryId;
	}
	
	public String getUserStoryName() {
		return userStoryName;
	}
	
	public void setUserStoryName(String userStoryName) {
		this.userStoryName = userStoryName;
	}
	
	public String getUserStoryDescription() {
		return userStoryDescription;
	}
	
	public void setUserStoryDescription(String userStoryDescription) {
		this.userStoryDescription = userStoryDescription;
	}
	
	public int getUserStoryType() {
		return userStoryType;
	}
	
	public void setUserStoryType(int userStoryType) {
		this.userStoryType = userStoryType;
	}
	
	public String getUserStoryTypeName() {
		return userStoryTypeName;
	}
	
	public void setUserStoryTypeName(String userStoryTypeName) {
		this.userStoryTypeName = userStoryTypeName;
	}
	
	public Integer getUserStoryStoryPoints() {
		return userStoryStoryPoints;
	}
	
	public void setUserStoryStoryPoints(Integer userStoryStoryPoints) {
		this.userStoryStoryPoints = userStoryStoryPoints;
	}

	public String getJson() {
		StringBuffer sb = new StringBuffer();
		Gson gson = new Gson();
		
		sb.append("{");
		sb.append("\"user_story_id\": " + gson.toJson(userStoryId) + ",");
		sb.append("\"user_story_name\": " + gson.toJson(userStoryName) + ",");
		sb.append("\"user_story_description\": " + gson.toJson(userStoryDescription) + ",");
		sb.append("\"user_story_type\": " + gson.toJson(userStoryType) + ",");
		sb.append("\"user_story_type_name\": " + gson.toJson(userStoryTypeName) + ",");
		sb.append("\"user_story_story_points\": " + gson.toJson(userStoryStoryPoints));
		sb.append("}");
		
		return sb.toString();
	}

}
